SG Window Window Object
FindWindows Method

©1998 by Stinga

Properties     Methods      Events     Constants     Error Codes
Description

Returns Windows collection of descendent windows with matching class name and text.

Syntax

object.FindWindows(className As String, text As String) As Windows

Part Description
object The object is expression that evaluates to Window object
className Required. String to search inside the window class name.
text Required. String to search inside the window text.
Remarks

Enumerates all descendent windows and matches specified class name string and text string against window's class and text. If specified strings are substrings of the window's class and text, FindWindows creates new Window object attached to the matched window and adds it to the result collection.
Empty string matches always.

Example

Following example shows how to find all windows that contain string "Thunder" in their class name:

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window
   Dim coll As SGWindow.Windows

   desktop.AttachDesktop
   Set coll = desktop.FindWindows("Thunder", "")
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next